﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UFIDA.U9.Cust.XH.PlugBE.Model;
using UFIDA.U9.Cust.XH.PlugBE.Tool;
using UFSoft.UBF.Business;
using UFSoft.UBF.Eventing;

namespace UFIDA.U9.Cust.XH.PlugBE
{
    /// <summary>
    /// 项目-进调度
    /// </summary>
    class ProjectInsertExtend : IEventSubscriber
    {
        public void Notify(params object[] args)
        {
            #region 从事件参数中取得当前业务实体													 

            if (args == null || args.Length == 0 || !(args[0] is UFSoft.UBF.Business.EntityEvent))
                return;
            BusinessEntity.EntityKey key = ((UFSoft.UBF.Business.EntityEvent)args[0]).EntityKey;
            if (key == null)
                return;
            UFIDA.U9.CBO.SCM.ProjectTask.Project entity = key.GetEntity() as UFIDA.U9.CBO.SCM.ProjectTask.Project;
            if (entity == null)
                return;
            #endregion

            ProjectModel model = new ProjectModel(entity);
            dataModel<ProjectModel> m1 = new dataModel<ProjectModel>(model);
            ReqTwoMode<ProjectModel> m = new ReqTwoMode<ProjectModel>(m1);
                     
            string res= OARestful.CallAPI("/api/cube/restful/interface/saveOrUpdateModeData/xmxx", JsonConvert.SerializeObject(m), "项目同步");

        }
    }
}
